<!DOCTYPE html>
<html lang="en">

<head>
    <base href="/">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>小米账号-登录</title>
    <link rel="stylesheet" href="login/login.css">
    <link rel="stylesheet" href="layui/css/layui.css">
</head>

<body>
    <div class="left-pic">
        <img src="login/img/denglu-left.jpg" alt="">
    </div>
    <div class="header">
        <div class="header-left">
            <img src="login/img/denglu-milogo.jpg" alt="">
            <p>小米账号</p>
        </div>
        <div class="header-right">
            <ul>
                <li><a href="#">用户协议</a></li>
                <li><a href="#">隐私政策</a></li>
                <li><a href="#">帮助中心</a></li>
                <li><span>|</span><a href="#" class="language">中文（简体）</a>
                    <ul class="language-list">
                        <li>中文(繁体)</li>
                        <li>English</li>
                        <li>蒙古语</li>
                        <li>沙特阿拉伯</li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div class="content">
        <div class="wrap">
            <div class="content-body">
                <div class="content-nav-list">
                    <ul>
                        <li class="denglu"><a href="#">登录</a></li>
                        <li class="zhuce"><a href="#">注册</a></li>
                    </ul>
                </div>
                <div style="clear:both;"></div>
                <div class="content-miform">
                    <form id="loginForm">
                        <input type="text" name="username" class="miform" placeholder="邮箱/手机号/小米ID" id="username">
                        <input type="password" name="password" class="miform" placeholder="密码" id="password">
                        <div class="accept">
                            <input type="checkbox" id="agreeCheckbox">
                            <span>我已阅读并同意小米账号用户协议和隐私政策</span>
                        </div>
                        <button class="login-btn" type="button" >登录</button>
                    </form>
                    <div class="inline">
                        <a href="#" class="wangjimima">忘记密码</a>
                        <a href="#" class="shoujihao">手机号登录</a>
                    </div>
                    <p class="qita">其他方式登录</p>
                    <div class="login-list">
                        <ul>
                            <li><img src="login/img/qq.png" alt=""></li>
                            <li><img src="login/img/qq.png" alt=""></li>
                            <li><img src="login/img/qq.png" alt=""></li>
                            <li><img src="login/img/qq.png" alt=""></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <!-- <script src="./check.js"></script> -->
    <div class="footer">
        <div class="wrap">
            <p class="footer-text">
                小米公司版权所有-京ICP备10046444-京公网安备11010802020134号-京ICP证110507号
            </p>
        </div>
    </div>
    <script src="login/value.js"></script>
    <script src="login/language.js"></script>
    <script src="layui/layui.all.js"></script>
<script>
    const $=layui.$;
    const layer=layui.layer;
    $(".login-btn").click(function(){
        //验证数据
        let username=$("[name='username']").val();
        let password=$("[name='password']").val();
        let reg=/^[a-zA-Z0-9]{6,16}$/;
        if(reg.test(username)&&reg.test(password)){
           //登录操作
            $.ajax({
                url:'shopping/dologin',
                data:{username:username,password:password},
                success:function(result){
                    if(result.code==200){
                        layer.msg("登录成功",{icon:1});
                        setTimeout(function(){
                            location.href="shopping/index";
                        },1800)
                    }else{
                        layer.msg(result.msg);
                    }
                }
            });
        }else{
            layer.msg("用户名和密码必须是6-16位字符数字");
            return;
        }
    });
</script>
</body>
</html>